Answer: A bit is the smallest unit of data in computing, representing a binary digit, either 0 or 1.
Answer: A byte is a unit of digital information comprising 8 bits.
Answer: There are 8 bits in a byte.
Answer: Bitwise AND (&) operator performs a bitwise AND operation on each pair of corresponding bits. The result is 1 only if both bits are 1, otherwise 0.
Answer: Bitwise OR (|) operator performs a bitwise OR operation on each pair of corresponding bits. The result is 1 if at least one of the bits is 1.
Answer: Bitwise XOR (^) operator performs a bitwise XOR operation on each pair of corresponding bits. The result is 1 if the bits are different, otherwise 0.
Answer: Bitwise NOT (~) operator performs a bitwise negation operation, flipping each bit from 0 to 1 and vice versa.
Answer: A bitmask is a binary pattern used for bitwise operations to manipulate or extract specific bits in a binary value.
Answer: You can use the bitwise OR (|) operator with a bitmask to set a specific bit to 1.
Answer: You can use the bitwise AND (&) operator with the complement of a bitmask to clear a specific bit.
Answer: Left shift (<<) operator shifts the bits of a number to the left by a specified number of positions, while right shift (>>) operator shifts the bits to the right.
Answer: You can use bitwise AND (&) operator with a bitmask to check if a specific bit is set.
Answer: A signed integer is a data type that can represent positive, negative, or zero values, using one bit for sign representation (usually in two's complement form).
Answer: An unsigned integer is a data type that represents only non-negative numbers, starting from zero.
Answer: To represent negative numbers in binary using two's complement, invert all bits of the positive binary number and add 1.
Answer: The largest value an 8-bit unsigned integer can hold is 255 (2^8 - 1).
Answer: Endianness refers to the byte ordering used to store multibyte data types in memory. It can be either little-endian (least significant byte first) or big-endian (most significant byte first).
Answer: To convert from little-endian to big-endian, reverse the byte order. Vice versa for converting from big-endian to little-endian.
Answer: Bitwise operations provide efficient ways to manipulate individual bits or groups of bits within variables, which is useful for tasks such as setting flags, packing data, and performing optimizations.